//package cn.skyquant.quant4j.service.boot.web.filter;
//
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.annotation.WebFilter;
//import java.io.IOException;
//
///**
// * Created by harley-dog on 2016/5/7.
// */
//@Component
//@WebFilter(urlPatterns = "/*",filterName = "loginFilter")
//public class CharacterEncodingFilter implements Filter {
//    private String encoding = "UTF-8";
//
//    private boolean forceEncoding = false;
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//    }
//
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        if (this.encoding != null && (this.forceEncoding || servletRequest.getCharacterEncoding() == null)) {
//            servletRequest.setCharacterEncoding(this.encoding);
//            if (this.forceEncoding) {
//                servletRequest.setCharacterEncoding(this.encoding);
//            }
//        }
//        filterChain.doFilter(servletRequest, servletResponse);
//    }
//
//    @Override
//    public void destroy() {
//    }
//}
